// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import http from './utils/http'
import store from './store/index'
import router from './router/index'
import Root from './Root.vue'

// 引入公共样式表
import 'normalize.css'
import 'animate.css'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// 引入echarts主模块（基础模块）
import ECharts from 'vue-echarts/components/ECharts.vue'

// 引入需要的echarts如表
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/line'
import 'echarts/lib/chart/pie'

// 引入需要的 echarts的交互组件
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/legend'
import 'echarts/lib/component/title'
import 'echarts/lib/component/visualMap'
import 'echarts/lib/component/toolbox'

import 'src/assets/styles/variable.scss'
import 'src/assets/styles/base.scss'
import 'src/assets/styles/common.scss'
import 'src/assets/styles/iconfont.css'

// i18n国际化
import i18n from './lang'

// toast
import toast from './alert/index'
Vue.use(toast)

Vue.use(ElementUI)

Vue.component('chart', ECharts)

Vue.config.productionTip = false

/* eslint-disable no-new */

// 将axios挂载到prototype上，在组件中可以直接使用this.axios访问
Vue.prototype.axios = http

new Vue({
  el: '#app',
  store,
  router,
  i18n, // 便于可以直接在组件中通过this.$i18n使用，也可以按需引用
  template: '<Root/>',
  components: { Root },
  data: {
    eventHub: new Vue() // 在main.js设置所有组件都能用调用
  }
})
